# utils.py
import copy

def deep_merge(base, update):
    """深度合并字典"""
    merged = copy.deepcopy(base)
    for key, value in update.items():
        if isinstance(value, dict):
            merged[key] = deep_merge(merged.get(key, {}), value)
        else:
            merged[key] = value
    return merged